#include ".\mygametextbutton.h"

const COLORREF CMyGameTextButton::crTextColor[5] = {RGB(0,0,0),
                                                RGB(0,255,0),
												RGB(255,0,0),
												RGB(0,255,0),
												RGB(128,128,128)};

CMyGameTextButton::CMyGameTextButton(void)
{
	m_nOffset = 1;
}

CMyGameTextButton::~CMyGameTextButton(void)
{
}

void CMyGameTextButton::LoadBmpFromFile(LPCSTR szFileName)
{
	return;
}

void CMyGameTextButton::SetOffset(int nOffset)
{
	m_nOffset = nOffset;
}

void CMyGameTextButton::Draw(HDC hDC)
{
	CMyGameWindow::Draw(hDC);
	int offset = 0;
	if (m_bsState == GBS_MouseDown)
	{
		offset = m_nOffset;
	}
	SetBkMode(hDC,TRANSPARENT);
	SetTextColor(hDC,crTextColor[m_bsState]);
	SIZE size = {0,0};
	GetTextExtentPoint32(hDC,m_strText.c_str(),m_strText.length(),&size);
	TextOut(hDC,
		    m_ptScreenPos.x + (m_nWidth - size.cx) / 2 + offset,
			m_ptScreenPos.y + (m_nHeight - size.cy) / 2 + offset,
			m_strText.c_str(),m_strText.length());
	return;
}

